<?php
/**
 * jishupu-cms
 * @Author:技术铺<jishupu@qq.com>
 * @Date: 2022/3/21
 */

namespace App\View\Components;

use Illuminate\View\Component;

/**
 * 图片预览组件
 * Class ImagePreviewModal
 * @package App\View\Components
 */
class ImagePreviewModal extends Component
{


    /**
     * id选择器名
     * @var
     */
    public $id = "";

    /**
     * class选择器名
     * @var
     */
    public $class = "";

    /**
     * 预览数据
     * @var
     * [
     *  [
     *      'title' => '', // 标题
     *      'image_url' => '', // 图片访问地址
     *      'description' => '', // 描述
     *      ......
     *  ],
     * ]
     */
    public $list = [];

    /**
     * 间隔时间（毫秒）
     * @var int
     */
    public $interval = 3000;

    /**
     * Create a new component instance.
     *
     * @return void
     */
    public function __construct($id = "", $class = "", $list = [], $interval = 3000)
    {
        $this->id = $id ?: $this->id;
        $this->class = $class ?: $this->class;
        $this->list = $list ?: $this->list;
        $this->interval = $interval ?: $this->interval;
    }

    /**
     * Get the view / contents that represent the component.
     *
     * @return \Illuminate\Contracts\View\View|\Closure|string
     */
    public function render()
    {
        return view('components.image-preview-modal');
    }
}
